<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    'use strict'
    // ES6的基本数据类型
    // Number, String, Null, undefined, Object, Symbol, Boolean
    // var a = 10;
    // console.log(this);
    // (function () {
    //   // console.log(a)
    //   var a = 20;
    //   console.log(window.a)
    //   // var a = 20;
    //   // console.log(a)
    // })()

    async function async1() {
      console.log('async1 start')
      await async2();
      console.log('async1 end')
    }

    async function async2() {
      console.log('async2')
      await async3()
      console.log('async2 end')
    }

    async function async3() {
      console.log('async3 start')
    }

    console.log('script start');

    setTimeout(() => { console.log('setTimeout1') }, 0)
    setTimeout(() => { console.log('setTimeout2') }, 0)
    // setImmediate(() => { console.log('setImmediate'), 0 })
    // process.nextTick(() => { console.log('next Tick') })
    async1()

    new Promise(function (resolve) {
      console.log('promise1')
      resolve()
      console.log('promise2')
    }).then(function () {
      console.log('promise3')
    })




    console.log('script end')

  </script>
</body>

</html>